<?php
namespace app\tag\controller;
use app\common\controller\UserBase;

class ApiUserTagsRel extends UserBase
{
    
    public function itemList()
    {
        $itemId = input('post.itemId');
        if (!$itemId) {
            return jsonError('缺少类型Id');
        }
        $tagsList = db('TagsRel')->where('item_id',$itemId)->select();
        if ($tagsList) {
            $tempTagsList = [];
            foreach ($tagsList as $k => $v) {
                $tagInfo = db('Tags')->where('id',$v['tags_id'])->find();
                if ($tagInfo) {
                    $v['tags'] = $tagInfo;
                    $tempTagsList[] = $v;
                }
            }
        }
        return jsonSuccess('',['itemList' => $tempTagsList]);
    }
    
}